#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:6031)

#include "string.h"
namespace bit
{
	void stringtest1()
	{
		string s("hello world");

		string::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it;
			it++;
		}
		cout << endl;
		for (auto e : s)
		{
			cout << e;
		}
		cout << endl;
		string s1(s);
		string s2 = s1;
		for (auto e : s1)
		{
			cout << e;
		}
		cout << endl;
		for (auto e : s2)
		{
			cout << e;
		}
		cout << endl;

	}
	void stringtest2()
	{
		string s("hello world");
		s += "hello world";
		for (auto e : s)
		{
			cout << e;
		}
		cout << endl;

		string s1;
		s1.push_back('a');
		s1.push_back('b');
		s1.push_back('c');
		s1.push_back('d');
		for (auto e : s1)
		{
			cout << e;
		}
		cout << endl;
		cout << (s < s1);
		cout << (s > s1);
		cout << (s == s1);
		cout << (s <= s1);
		cout << (s >= s1);
		cout << true;
	}
	void stringtest3()
	{
		string s("hello world");
		string s1 = "excuse me";
		/*s.swap(s1);
		cout << s.c_str() << " " << s1.c_str() << endl;
		cout << s.capacity() << endl;
		s.reserve(100);
		cout << s.capacity() << endl;
		s.resize(5);
		cout << s.capacity() << " " << s.c_str() << endl;;*/
		//cout << s[0];
		size_t pos = s.find("world");
		cout << pos << endl;
		cout << s.substr().c_str() << endl;
		s.insert(0, 'w');
		cout << s.c_str() << endl;
		s.insert(6, 'e');
		cout << s.c_str() << endl;
		s1.insert(0, "hello");
		cout << s1.c_str() << endl;
		s1.insert(5, "hello");
		cout << s1.c_str() << endl;
		cin >> s1;
		cout << s1;

	}
}
int main()
{
	bit::stringtest1();
	bit::stringtest2();
	bit::stringtest3();

	return 0;
}